package com.edu.service.impl;

import com.edu.bean.User;
import com.edu.dao.UserDao;
import com.edu.dao.impl.UserDaoImpl;
import com.edu.service.UserService;

public class UserServiceImpl implements UserService {

    public User userLogin(String userName, String userPass) {
        UserDao ud=new UserDaoImpl();
        int num=ud.selectByUserName(userName);
        if(num==-1){
            System.out.println("账号不存在");
            User user01=new User();
            user01.setUserId(-2);
            return user01;
        }
        User user=ud.selectByUser(userName,userPass);
        if (user.getUserId()==-1){
            System.out.println("密码错误");
            return user;
        }
        return user;
    }
}
